<#assign module="area"/>

<#macro padZero value>
	<#if value?length==1>
		0${value}
	<#else>
		${value}
	</#if>
</#macro>
<@override name="header">
</@override>
<@override name="body">

	<div class="panel panel-default">
		<div class="panel-body" style="padding:30px;">
			<form action="${ctx}/area/update" class="form-horizontal" method="post">
				<input type="hidden" name="id" value="${area.id}">
				<fieldset>
					<legend>1、地区名称</legend>
	                <div class="form-group">
	                    <label class="col-sm-3 control-label"><em>*</em>地区名称：</label>
	                    <div class="col-sm-4">
	                        <input class="form-control" id="name" name="name" value="${area.name?if_exists}" type="text" required />
	                    </div>
	                    <div class="col-sm-5">
	                        <span class="help">填写地区的名称，如：成都市</span>
	                    </div>
	                </div>
	            </fieldset>
	            
				<fieldset>
					<legend>2、起步费设置（分时段）</legend>
	                <div class="form-group">
	                    <label class="col-sm-3 control-label"><em>*</em>几公里起步：</label>
	                    <div class="col-sm-4">
	                        <input class="form-control" id="qblc" name="qblc" value="${area.qblc?if_exists}" data-val="true" data-val-number="字段 起步公里数 必须是一个数字。" data-val-required="起步公里数 字段是必需的。"  type="number" required />
	                    </div>
	                    <div class="col-sm-5">
	                        <span  class="help">起步公里数，如：5公里起步，则输入5</span>
	                    </div>
	                </div>
	                
	                <div class="form-group">
	                    <label class="col-sm-3 control-label"></label>
	                    <div class="col-sm-4">
	                        <div id="feesettingsList" class="form-group" style="padding-left: 10px;">
	                        	<#if area.chargeStartTimes??>
	                        		<#list area.chargeStartTimes as chargeStartTime>
                                        <@compress single_line=true>
                                        <div class="zone-item">
					    				<@padZero chargeStartTime.startHour /> : <@padZero chargeStartTime.startMinute /> 至  <@padZero chargeStartTime.endHour /> : <@padZero chargeStartTime.endMinute /> 起步价: ${chargeStartTime.cost} 元
					    				&nbsp;<a class="zone-close" title="删除该时间段" href="javascript:void(0);" onclick="deleteZone(this)">删除该时段</a>
                                        </@compress>
					    				<input type="hidden" name="chargeStartTimes[${chargeStartTime_index}].startHour" value="${chargeStartTime.startHour}">
					    				<input type="hidden" name="chargeStartTimes[${chargeStartTime_index}].startMinute" value="${chargeStartTime.startMinute}">
					    				<input type="hidden" name="chargeStartTimes[${chargeStartTime_index}].endHour" value="${chargeStartTime.endHour}">
					    				<input type="hidden" name="chargeStartTimes[${chargeStartTime_index}].endMinute" value="${chargeStartTime.endMinute}">
					    				<input type="hidden" name="chargeStartTimes[${chargeStartTime_index}].cost" value="${chargeStartTime.cost}">
					    				</div>
	                        		</#list>
	                        	</#if>
	                        </div>
	                    </div>
	                </div>
	                
	                <div class="form-group">
	                	<div class="zone-layer col-sm-offset-3 col-sm-9" id="zone-layer" style="background-color: rgb(243, 243, 243); padding-top: 10px;padding-bottom: 10px; display: none;">
	                		<select id="startHour" style="width:60px;vertical-align:middle;">
	                			<#list hourlist as hour>
	                				<#if (hour>=10)>
	                					<option value="${hour}">${hour}时</option>
	                				<#else>
	                					<option value="${hour}">0${hour}时</option>
	                				</#if>
	                			</#list>
	                		<select>
	                		<select id="startMinute" style="width:60px;vertical-align:middle;">
	                			<#list minutelist as minute>
	                				<#if (minute>=10)>
	                					<option value="${minute}">${minute}分</option>
	                				<#else>
	                					<option value="${minute}">0${minute}分</option>
	                				</#if>
	                			</#list>
	                		<select>
	                		至
	                		<select id="endHour" style="width:60px;vertical-align:middle;">
	                			<#list hourlist as hour>
	                				<#if (hour>=10)>
	                					<option value="${hour}">${hour}时</option>
	                				<#else>
	                					<option value="${hour}">0${hour}时</option>
	                				</#if>
	                			</#list>
	                		<select>
	                		<select id="endMinute" style="width:60px;vertical-align:middle;">、
	                			<#list minutelist as minute>
	                				<#if (minute>=10)>
	                					<option value="${minute}">${minute}分</option>
	                				<#else>
	                					<option value="${minute}">0${minute}分</option>
	                				</#if>
	                			</#list>
	                		<select>
	                		&nbsp;&nbsp;单价：
	                		<input id="cost" style="width:60px;vertical-align:middel;" type="number" value="">
	                		元
	                		<input type="button" value="确定" id="zone-ok" class="btn btn-primary" style="margin-left: 10px;">
	                		<input type="button" value="取消" id="zone-cancel" class="btn btn-default">
	                		
	                	</div>
	                </div>
	                
	                <div class="form-group">
	                    <div class="col-sm-offset-3 col-sm-9 passed">
	                        <input type="button" id="zone-add" value="添加时段" class="btn btn-info">
	                    </div>
	                </div>
                </fieldset>
                
                <fieldset>
                	<legend>3、等时费设置（从到达客人所在地开始计算）</legend>
                	
                	<div class="form-group">
	                    <label class="col-sm-3 control-label"><em>*</em>免费等候时间：</label>
	                    <div class="col-sm-4">
	                        <input class="form-control" id="mfdhsj" name="mfdhsj" value="${area.mfdhsj?if_exists}" type="number" required />
	                    </div>
	                    <div class="col-sm-5">
	                        <span  class="help">如：30分钟内不收费，单位：分钟</span>
	                    </div>
	                </div>
	                
	                <div class="form-group">
	                    <label class="col-sm-3 control-label"><em>*</em>计费时间：</label>
	                    <div class="col-sm-4">
	                        <input class="form-control" id="dhsjUnit" name="dhsjUnit" value="${area.dhsjUnit?if_exists}" type="number" required />
	                    </div>
	                    <div class="col-sm-5">
	                        <span  class="help">如：每20分钟需支付10元，则在此输入20，单位：分钟</span>
	                    </div>
	                </div>
	                
	                <div class="form-group">
	                    <label class="col-sm-3 control-label"><em>*</em>跳表阀值：</label>
	                    <div class="col-sm-4">
	                        <input class="form-control" id="dhsjThresholdt" name="dhsjThresholdt" value="${area.dhsjThresholdt?if_exists}" type="number" required />
	                    </div>
	                    <div class="col-sm-5">
	                        <span class="help">如：每超过5分钟，就按20分钟计算，则在此输入5，单位：分钟</span>
	                    </div>
	                </div>
	                
	                <div class="form-group">
	                    <label class="col-sm-3 control-label"><em>*</em>计费时间费用：</label>
	                    <div class="col-sm-4">
	                        <input class="form-control" id="dhsjCost" name="dhsjCost" value="${area.dhsjCost?if_exists}" type="number" required />
	                    </div>
	                    <div class="col-sm-5">
	                        <span  class="help">如：每等20分钟需支付10元，则在此输入10，单位：元</span>
	                    </div>
	                </div>
	                
                </fieldset>
                
                <fieldset>
                	<legend>4、代驾费（从代驾出发开始计算）</legend>
                	
	                <div class="form-group">
	                    <label class="col-sm-3 control-label"><em>*</em>计费公里：</label>
	                    <div class="col-sm-4">
	                        <input class="form-control" id="djglUnit" name="djglUnit" value="${area.djglUnit?if_exists}" type="number" required />
	                    </div>
	                    <div class="col-sm-5">
	                        <span  class="help">如：每3公里需支付10元，则在此输入3，单位：公里</span>
	                    </div>
	                </div>
	                
	                <div class="form-group">
	                    <label class="col-sm-3 control-label"><em>*</em>跳表阀值：</label>
	                    <div class="col-sm-4">
	                        <input class="form-control" id="djglThresholdt" name="djglThresholdt" value="${area.djglThresholdt?if_exists}" type="number" required />
	                    </div>
	                    <div class="col-sm-5">
	                        <span  class="help">如：每超过1公里，就按3公里计算，则在此输入1，单位：公里</span>
	                    </div>
	                </div>
	                
	                <div class="form-group">
	                    <label class="col-sm-3 control-label"><em>*</em>计费公里费用：</label>
	                    <div class="col-sm-4">
	                        <input class="form-control" id="djglCost" name="djglCost" value="${area.djglCost?if_exists}" type="number" required />
	                    </div>
	                    <div class="col-sm-5">
	                        <span  class="help">如：每3公里需支付10元，则在此输入10，单位：元</span>
	                    </div>
	                </div>
	                
                </fieldset>
                
                <fieldset>
                	<legend>5、其他价格说明（此说明将显示在客户端APP上，供客人查看）</legend>
                	
	                <div class="form-group">
	                    <label class="col-sm-3 control-label"><em>*</em>收费说明：</label>
	                    <div class="col-sm-4">
	                        <textarea class="form-control" cols="20" id="memo" name="memo" placeholder="例如：1. 不同时间段，起步价不同，以开车时间为准。2. 每超过10公里， 加收20元，超过3公里按10公里计算。3. 30分钟以内免费 等待，超出部分每30分钟加收20元等时费。" rows="2" style="height:120px;" required>${area.memo?if_exists}</textarea>
	                    </div>
	                    <div class="col-sm-5">
	                        <span class="help">该说明将显示在手机客户端上，请注意格式</span>
	                    </div>
	                </div>
	                
                </fieldset>
                
                <div class="form-group" style="margin-left:10px;">
	                <label class="col-sm-3 control-label"></label>
	                <input type="submit" class="btn btn-primary" value="保存">
	                <input type="button" class="btn btn-default" onclick="window.location.href = '${ctx}/area/list';" value="返回">
	            </div>
			</form>
		</div>
	</div>

</@override>
<@override name="footer">
	<script src="${ctx}/assets/js/area.js"></script>
</@override>
<@extends name="../layout.ftl"/>